//
//  HDBankInformationCell.swift
//  HuaDaoPeifu
//
//  Created by liangyuanliangyuan on 16/4/19.
//  Copyright © 2016年 paiyipai. All rights reserved.
//

import UIKit


class HDBankInformationCell: UITableViewCell {

    var backView:UIImageView?
    var bankNumber = HDBankLittleView()
    var bankOpen = HDBankLittleView()
    var bankOpenheight: CGFloat?
    
    init(data: HDUserBankInfo,style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        backView = UIImageView()
        backView?.image = UIImage(named: "银行信息bg")
        self.addSubview(backView!)
    

        backView?.snp.updateConstraints { (make) -> Void in
            make.left.top.equalTo(15)
            make.right.equalTo(-15)
            make.bottom.equalTo(0)
        }

        bankNumber.bankAtRight?.text = data.bankcode ?? "*****"
        bankNumber.bankAtLeft?.text = "银行账号"
        backView!.addSubview(bankNumber)
        bankNumber.snp.updateConstraints { (make) in
            make.left.equalTo(0)
            make.right.equalTo(0)
            make.top.equalTo(27)
            make.height.equalTo(15)
        }
        
        bankOpen.bankAtRight?.text = data.bank ?? "-----"
        bankOpen.bankAtLeft?.text = "开户银行"
        let bankSize = bankOpen.bankAtRight?.text?.getTextRectSize((bankOpen.bankAtRight?.text)! as NSString, font: UIFont.systemFont(ofSize: 15), size: CGSize(width: AppConstant.screenWidth-67, height: 2000))
        bankOpenheight = bankSize?.height
        backView!.addSubview(bankOpen)
        bankOpen.snp.updateConstraints { (make) in
            make.left.equalTo(0)
            make.right.equalTo(0)
            make.top.equalTo(bankNumber.snp.bottom).offset(27)
            make.height.equalTo(bankOpenheight!)
        }
        super.updateConstraints()

    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
